import ServiceBase from '../base';
import * as proxy from '../proxy';
class ComponentService extends ServiceBase {
    public createdQRcode = (data) => {
        const promise = super.post({
            data: data.data,
            headers: {'content-Type': 'application/json'},
            url: `/accounts/${data.accountId}/projects/${data.projectId}/files/${data.fileId}/locationComponents`,
        });
        return proxy.httpResultProxy(promise);
    };

    public getQRcodes = (data) => {
        const extend = `?order[]=${data.order}&pageNumber=${data.pageNumber}&pageSize=${data.pageSize}`;
        const promise = super.get({
            data: data.data,
            url:
                `/accounts/${data.accountId}/projects/${data.projectId}/files/${data.fileId}/locationComponents` +
                extend,
        });
        return proxy.httpResultProxy(promise);
    };

    public deleteQRcode = (data) => {
        const promise = super.delete({
            url:
                `/accounts/${data.accountId}/projects/${data.projectId}/files/${data.fileId}/locationComponents` +
                `?locationComponentId[]=${data.componentIds}`,
        });
        return proxy.httpResultProxy(promise);
    };
}

export {ComponentService};
